import java.util.Scanner;

public class Day202 {
    //内存可见性问题
    public volatile static int count  = 0;
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
           while (count ==0 ) {
               System.out.println("1111");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
            System.out.println("t1线程执行结束");
        });
        Thread t2 = new Thread(()->{
            Scanner in = new Scanner(System.in);
            System.out.print("请输入一个数:");
            count = in.nextInt();
        });
        t1.start();
        t2.start();


    }
}
